package com.ce.pms.base.dao;

import java.io.Serializable;
import java.sql.SQLException;
import java.util.Collection;
import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.SQLQuery;

import com.sitechasia.webx.core.dao.IDomainObjectQueryCache;
import com.sitechasia.webx.core.support.Page;

public interface IPmsBaseHibernateDao {
	public  void genericSave(Class clazz, Object o);

	public abstract List findInBase(String hql, Object... values);

	public abstract Query createQuery(String hql);

	public abstract SQLQuery createSQLQuery(String sql);

	public abstract Criteria createCriteriaBy(Class entityClass,String name , Object value);

	public abstract Criteria createCriteriaByLike(Class entityClass,String name ,String value);

	public abstract Criteria createCriteriaUniqueBy(Class entityClass,String name , Object value);

	public abstract Object queryUnique(Criteria criteria);

	public abstract List queryObjectInBase(Criteria criteria);

	public List genericFindBy(Class entityClass, String name, Object value) ;


	public List genericFindByLike(Class entityClass, String name, String value) ;


	public Object genericFindUniqueBy(Class entityClass, String name, Object value);


	public Object genericGet(Class entityClass, Serializable id);


	public List genericGetAll(Class entityClass) ;


	public void genericRemove(Class clazz, Object o) ;


	public void genericRemoveById(Class entityClass, Serializable id);


	public void genericSaveAll(Class clazz, Collection list) ;



	public Criteria getEntityCriteria(Class entityClass) ;



	public boolean isGenericNotUnique(Class entityClass, Object entity, String names) ;



	public Page pagedQuery(Criteria criteria, int pageNo, int pageSize);



	public Page pagedQuery(String hql, int pageNo, int pageSize, Object... args) ;



	public void setEntityQueryCache(IDomainObjectQueryCache entityQueryCache) ;


	public void executeSQL(String sql,Object[] args);

	public void executeSQL(final String sql,final Object[][] args);

	/**
	 * 功能描述:批量插入<br>
	 * @param sql
	 * @param parameters<br>
	 * Create author:罗军林<br>
	 * Create on:2008-8-13<br>
	 * Edit author:<br>
	 * Edit on:<br>
	 * Why:<br>
	 */
	public void executeSQLBatch(final String sql,final List<Object[]> parameters);

	public void flush();

	public void clear();

	/**
	 * 功能描述:加载指定标识的对象<br>
	 * @param entiyClass
	 * @param id
	 * @return<br>
	 * Create author:罗军林<br>
	 * Create on:2008-12-8<br>
	 * Edit author:<br>
	 * Edit on:<br>
	 * Why:<br>
	 */
	public Object loadById(Class entiyClass,Serializable id);

}
